package io.renren.modules.ht.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.ht.dao.ContractsAmountDao;
import io.renren.modules.ht.dao.ContractsDao;
import io.renren.modules.ht.entity.ContractsAmountEntity;
import io.renren.modules.ht.entity.ContractsEntity;
import io.renren.modules.ht.service.ContractsAmountService;
import io.renren.modules.ht.service.ContractsService;
import org.springframework.stereotype.Service;

import java.util.Map;


@Service("contractsAmountService")
public class ContractsAmountServiceImpl extends ServiceImpl<ContractsAmountDao, ContractsAmountEntity> implements ContractsAmountService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        QueryWrapper<ContractsAmountEntity> wrapper = new QueryWrapper<>();
        if(params.get("contractId")!=null){
            wrapper.eq("contract_id",params.get("contractId"));
        }
        IPage<ContractsAmountEntity> page = this.page(
                new Query<ContractsAmountEntity>().getPage(params),

                wrapper.eq("amount_status","1").orderByDesc("update_time")
        );

        return new PageUtils(page);
    }

}